package request

import (
	"gitcode.com/G-YT/ANN/server/model/common/request"
	"gitcode.com/G-YT/ANN/server/model/health"
	"gitcode.com/G-YT/ANN/server/model/hierarchy"
)

type FdEfficacySearch struct {
	health.FdEfficacy
	request.PageInfo
}

type FdEfficacyArticle struct {
	FdEfficacyID     uint                        `json:"fd_efficacy_id" gorm:"column:fd_efficacy_id;"`
	ArticleID        uint                        `json:"article_id" gorm:"column:article_id;"`
	Type             string                      `json:"type" gorm:"column:type;"`
	Efficacy         *health.FdEfficacy          `json:"-" form:"-" gorm:"->;foreignKey:FdEfficacyID;references:ID;"` // 关联功效
	FdArticleAudio   *hierarchy.FdArticleAudio   `json:"-" form:"-" gorm:"->;foreignKey:ArticleID;references:ID;"`    // 关联音频文章
	FdArticleVideo   *hierarchy.FdArticleVideo   `json:"-" form:"-" gorm:"->;foreignKey:ArticleID;references:ID;"`    // 关联视频文章
	FdArticleGraphic *hierarchy.FdArticleGraphic `json:"-" form:"-" gorm:"->;foreignKey:ArticleID;references:ID;"`    // 关联图文文章
}

type FdEfficacyArticleReq struct {
	FdEfficacyID uint   `json:"fd_efficacy_id" gorm:"column:fd_efficacy_id;"`
	Graphics     []uint `json:"graphic_id" gorm:"column:graphic_id;"`
	Audios       []uint `json:"audio_id" gorm:"column:audio_id;"`
	Videos       []uint `json:"video_id" gorm:"column:video_id;"`
}

func (FdEfficacyArticle) TableName() string {
	return "fd_efficacy_article"
}
